@model UserDetailViewModel
@{
    ViewData["Title"] = "用户详情";
}

<h2>用户详情</h2>

<div class="card shadow-sm">
    <div class="card-header bg-light">
        <h5 class="card-title mb-0">用户详情</h5>
    </div>
    <div class="card-body">
        <div class="row">
            <div class="col-md-6">
                <dl class="row">
                    <dt class="col-sm-4">姓名</dt>
                    <dd class="col-sm-8">@Model.Name</dd>

                    <dt class="col-sm-4">工号</dt>
                    <dd class="col-sm-8">@Model.EmployeeNumber</dd>

                    <dt class="col-sm-4">电话</dt>
                    <dd class="col-sm-8">@Model.Phone</dd>

                    <dt class="col-sm-4">邮箱</dt>
                    <dd class="col-sm-8">@Model.Email</dd>
                </dl>
            </div>
            <div class="col-md-6">
                <dl class="row">
                    <dt class="col-sm-4">性别</dt>
                    <dd class="col-sm-8">@(Model.Gender == 1 ? "男" : Model.Gender == 2 ? "女" : "未知")</dd>

                    <dt class="col-sm-4">出生日期</dt>
                    <dd class="col-sm-8">@Model.BirthDate?.ToString("yyyy-MM-dd")</dd>

                    <dt class="col-sm-4">户籍地</dt>
                    <dd class="col-sm-8">@Model.Hometown</dd>
                </dl>
            </div>
        </div>

        <!-- 角色信息 -->
        <div class="mt-4">
            <h5>角色列表</h5>
            @if (Model.Roles.Any())
            {
                <ul class="list-group">
                    @foreach (var role in Model.Roles)
                    {
                        <li class="list-group-item">@role.Name</li>
                    }
                </ul>
            }
            else
            {
                <p class="text-muted">该用户暂无角色</p>
            }
        </div>
    </div>
    <div class="card-footer bg-transparent">
        <a asp-action="Edit" asp-route-id="@Model.Id" class="btn btn-warning me-2">编辑</a>
        <a asp-action="AssignRoles" asp-route-id="@Model.Id" class="btn btn-info me-2">分配角色</a>
        <a asp-action="Index" class="btn btn-secondary">返回列表</a>
    </div>
</div>
